import sys


def mean(vector):
    return 1.0 * sum(vector) / len(vector)

def std(vector):
    if len(vector) <= 1:
        return 0.0
    m = mean(vector)
    return (1.0 * sum([(x - m) * (x - m) for x in vector]) / (len(vector) - 1.0)) ** 0.5

def warn(message):
    sys.stderr.write(message + '\n')

def die(message, exit_code=1):
    sys.stderr.write(message + '\n')
    sys.exit(exit_code)

KITTUR_WORK_TYPES =  ['Article', 'Article Talk', 'User', 'User Talk', 'Other', 'Maintenance']
